/* GUI CONVERTED from ececiq.p (converter v1.75) Fri May 18 00:03:37 2001 */
/* ececiq.p - PCR/PCO INQUIRY                                                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.17 $                                                               */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.4      LAST MODIFIED: 09/24/93   BY: pma *H013*                */
/* REVISION: 7.4      LAST MODIFIED: 11/16/94   BY: qzl *H602*                */
/* REVISION: 7.4      LAST MODIFIED: 04/10/95   BY: jpm *H0CH*                */
/* REVISION: 7.4      LAST MODIFIED: 10/13/95   BY: ame *H0GF*                */
/* REVISION: 8.5      LAST MODIFIED: 06/18/96   BY: *J0TY* Rob Wachowicz      */
/* REVISION: 8.5      LAST MODIFIED: 08/02/96   BY: *H0M8* Russ Witt          */
/* REVISION: 8.5      LAST MODIFIED: 11/05/96   BY: *J17Q* Murli Shastri      */
/* REVISION: 8.6      LAST MODIFIED: 11/22/96   BY: *K00C* Joe Gawel          */
/* REVISION: 8.6      LAST MODIFIED: 03/19/97   BY: Verghese Kurien *K087*    */
/* REVISION: 8.6      LAST MODIFIED: 03/31/97   BY: Joe Gawel   *K08X*        */
/* REVISION: 8.6      LAST MODIFIED: 10/07/97   BY: John Worden *K0LP*        */
/* REVISION: 8.6      LAST MODIFIED: 10/07/97   BY: mzv *K0M5*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 09/14/98   BY: *L07Q* A. Shobha          */
/* REVISION: 8.6E     LAST MODIFIED: 10/09/98   BY: *J31W* Santhosh Nair      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0KW* Jacolyn Neder      */
/* REVISION: 9.1      LAST MODIFIED: 11/21/00   BY: *M0WS* Vandna Rohira      */
/* $Revision: 1.17 $       BY: Falguni               DATE: 05/14/01 ECO: *M14J*    */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE ececiq_p_1 "Created By"
/* MaxLen: 20 Comment: */

&SCOPED-DEFINE ececiq_p_2 "Class"
/* MaxLen: 10 Comment: */

&SCOPED-DEFINE ececiq_p_3 "User Code [1]"
/* MaxLen: 17 Comment: */

&SCOPED-DEFINE ececiq_p_4 "Originator"
/* MaxLen: 20 Comment: */

&SCOPED-DEFINE ececiq_p_5 "User Code [2]"
/* MaxLen: 17 Comment: */

&SCOPED-DEFINE ececiq_p_6 "Reason"
/* MaxLen: 12 Comment: */

/* ********** End Translatable Strings Definitions ********* */

define variable doc as character.
define variable nbr like ecm_nbr.
define variable ecmid like wo_lot.
define variable dbase like si_db.
define variable new_ecn like mfc_logical.
define variable ecm_recid as recid.
define variable section as integer.
define variable prog_name like mnd_exec.
define variable prog_type as character.
define variable sngl_yn like mfc_logical.
define variable local_type like ecm_type.
define variable auto_nbr like mfc_logical.
define variable i as integer.
define variable msgnbr like msg_nbr.
define variable warnlvl as integer.
define variable len as integer.
define variable del-yn like mfc_logical initial no.

define new shared variable yn like mfc_logical.
define shared variable global_recid as recid.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
ecm_nbr             colon 12
   ecmid               colon 36
   dbase               colon 58
with frame a attr-space side-labels width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   ecm_type            colon 7
   ecm_assign          colon 31
   ecm_init            colon 53 label {&ececiq_p_1}
   ecm_doc_type        at 65    no-label format "x(3)"
   ecm_open_date       at 70    no-label skip(1)
   ecm_title           colon 12 skip
   ecm_cmmt[1]         colon 12 label {&ececiq_p_6}
   ecm_cmmt[2 for 4]   at 14    no-label
   ecm_status          colon 12 label {&ececiq_p_2}
   ecm_user1           colon 58 label {&ececiq_p_3}
   ecm_name            colon 12 label {&ececiq_p_4}
   ecm_user2           colon 58 label {&ececiq_p_5}
with STREAM-IO /*GUI*/  frame c attr-space side-labels width 80.

/* SET EXTERNAL LABELS */
setFrameLabels(frame c:handle).

{wbrp01.i}

mainloop:
repeat with frame a:
   hide frame b no-pause.
   view frame a.
   view frame c.
   assign
      nbr = ""
      ecmid = ""
      dbase = ""
      new_ecn = no
      prog_name = "ececiq.p"
      section = 0.

   nbrloop:
   do transaction on error undo, retry:

      global_recid = ?.

      if c-application-mode <> 'web' then
         prompt-for ecm_nbr ecmid dbase with frame a
      editing:

         /* Allow last number refresh */
         if keyfunction(lastkey) = "RECALL" or lastkey = 307
            then display nbr @ ecm_nbr with frame a.

         {mfnp05.i ecm_mstr ecm_mstr
            "(ecm_nbr <> ""*000000*"")"
            ecm_nbr "input ecm_nbr"}

         if global_recid <> ? then do:
            recno = global_recid.
            find ecm_mstr where recid(ecm_mstr) = recno
               no-lock no-error.
            global_recid = ?.
         end.

         if recno <> ? then do:
            ecmid = substring(ecm_nbr,9,8).
            dbase = substring(ecm_nbr,17,8).

            display
               ecm_nbr
               ecmid
               dbase
            with frame a.

            display
               ecm_type
               ecm_assign
               ecm_init
               ecm_doc_type
               ecm_open_date
               ecm_title
               ecm_cmmt[1]
               ecm_cmmt[2 for 4]
               ecm_status
               ecm_user1
               ecm_name
               ecm_user2
            with frame c STREAM-IO /*GUI*/ .

         end.
      end.

      {wbrp06.i &command = prompt-for &fields = "  ecm_nbr ecmid dbase"
                &frm = "a"}

      if (c-application-mode <> 'web') or
         (c-application-mode = 'web' and
         (c-web-request begins 'data')) then do:

         global_recid = ?.

         assign ecmid dbase.

         nbr = string(input ecm_nbr, "x(8)")
             + string(ecmid, "x(8)")
             + string(dbase, "x(8)").

         find first ecm_mstr no-lock where ecm_nbr = nbr no-error.
         if not available ecm_mstr then do:
            {pxmsg.i &MSGNUM=2161 &ERRORLEVEL=3} /*ECN Does not exist*/
            if c-application-mode = 'web' then return.
            undo, retry.
         end.

         ecm_recid = recid(ecm_mstr).

         display
            ecm_nbr
            ecmid
            dbase
         with frame a.

         display
            ecm_type
            ecm_assign
            ecm_init
            ecm_doc_type
            ecm_open_date
            ecm_title
            ecm_cmmt[1]
            ecm_cmmt[2 for 4]
            ecm_status
            ecm_user1
            ecm_name
            ecm_user2
         with frame c STREAM-IO /*GUI*/ .

      end.
   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   rptloop:
   do on error undo, leave:
      yn = no.
      prog_name = "ececiq.p".
      hide message no-pause.

      pause 0.

      display
         ecm_type
         ecm_assign
         ecm_init
         ecm_doc_type
         ecm_open_date
         ecm_title
         ecm_cmmt[1]
         ecm_cmmt[2 for 4]
         ecm_status
         ecm_user1
         ecm_name
         ecm_user2
      with frame c STREAM-IO /*GUI*/ .

      FORM /*GUI*/ 
         ecm_nbr             colon 12
         ecmid               colon 36
         dbase               colon 58
         ecm_doc_type        colon 70 no-label format "x(3)"
         ecm_title           colon 12
         skip(.1)
      with STREAM-IO /*GUI*/  frame b attr-space side-labels width 80.

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      hide frame a no-pause.
      hide frame c no-pause.
      display
         substring(ecm_nbr,1,8)  @ ecm_nbr
         substring(ecm_nbr,9,8)  @ ecmid
         substring(ecm_nbr,17,8) @ dbase
         ecm_doc_type
         ecm_title
      with frame b STREAM-IO /*GUI*/ .

      /*TEXT*/

      pause 0.
      {gprun.i ""eciq01.p"" "(input ecm_recid,
                              input prog_type,
                              input yes,
                              output msgnbr,
                              output warnlvl)"}

      
/*GUI*/ {mfguichk.i  &label=rptloop} /*Replace mfrpchk*/


      if c-application-mode <> 'web' then
         pause before-hide.

      /*ITEMS*/
      {gprun.i ""eciq02.p"" "(input ecm_recid,
                              input prog_type,
                              input yes,
                              output msgnbr,
                              output warnlvl)"}

      
/*GUI*/ {mfguichk.i  &label=rptloop} /*Replace mfrpchk*/


      /*STRUCTURES*/
      {gprun.i ""eciq03.p"" "(input ecm_recid,
                              input prog_type,
                              input yes,
                              output msgnbr,
                              output warnlvl)"}

      
/*GUI*/ {mfguichk.i  &label=rptloop} /*Replace mfrpchk*/


      /*ROUTINGS*/
      {gprun.i ""eciq06.p"" "(input ecm_recid,
                              input prog_type,
                              input yes,
                              output msgnbr,
                              output warnlvl)"}

      
/*GUI*/ {mfguichk.i  &label=rptloop} /*Replace mfrpchk*/


      /*ITEM SPECIFICATIONS*/
      {gprun.i ""eciq07.p"" "(input ecm_recid,
                              input prog_type,
                              input yes,
                              output msgnbr,
                              output warnlvl)"}

      
/*GUI*/ {mfguichk.i  &label=rptloop} /*Replace mfrpchk*/


      /*APPROVALS*/
      {gprun.i ""eciq04.p"" "(input ecm_recid,
                              input prog_type,
                              input yes,
                              output msgnbr,
                              output warnlvl)"}

      
/*GUI*/ {mfguichk.i  &label=rptloop} /*Replace mfrpchk*/


   end.

   hide frame b no-pause.
   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

end. /*mainloop*/

status input.
prog_name = "".

{wbrp04.i &frame-spec = a}
